<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('项目经理催款')" />
    <link rel="stylesheet" href="../../../../../../../../../../../../css/navigation.css">
</head>
<body class="gray-bg">
<div class="navigation visible-xs-block">
    <ol class="breadcrumb">
        <span> > </span>
        <li><a href="#" onclick="gomain()">主页</a></li>
        <li style="color: black">项目经理催款</li>
    </ol>
    <div class="aLine"></div>
</div>
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
<!--                            <li>-->
<!--                                <label>劳务金额	：</label>-->
<!--                                <input type="text" name="dCost"/>-->
<!--                            </li>-->
<!--                            <li>-->
<!--                                <label>供应商名称/应付单位名称：</label>-->
<!--                                <input type="text" name="dSupplierName"/>-->
<!--                            </li>-->
<!--                            <li>-->
<!--                                <label>申请人：</label>-->
<!--                                <input type="text" name="dProposer"/>-->
<!--                            </li>-->
<!--                            <li>-->
<!--                                <label>申请内容：</label>-->
<!--                                <input type="text" name="dApplicationContent"/>-->
<!--                            </li>-->
<!--                            <li class="select-time">-->
<!--                                <label>申请时间：</label>-->
<!--                                <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginDCreateTime]"/>-->
<!--                                <span>-</span>-->
<!--                                <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endDCreateTime]"/>-->
<!--                            </li>-->
<!--                            <li>-->
<!--                                <label>总项目关联：</label>-->
<!--                                <input type="text" name="pId"/>-->
<!--                            </li>-->
<!--                            <li>-->
<!--                                <label>照片：</label>-->
<!--                                <input type="text" name="dFile"/>-->
<!--                            </li>-->
<!--                            <li>-->
<!--                                <label>劳务合同：</label>-->
<!--                                <input type="text" name="aLabor"/>-->
<!--                            </li>-->
<!--                            <li>-->
<!--                                <label>申请状态：</label>-->
<!--                                <select name="aStatus">-->
<!--                                    <option value="">所有</option>-->
<!--                                </select>-->
<!--                            </li>-->
<!--                            <li>-->
<!--                                <label>审批意见：</label>-->
<!--                                <input type="text" name="aOpinion"/>-->
<!--                            </li>-->
                            <li>
                                <label>文件名称：</label>
                                <input type="text" name="pFileName"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
     <th:block th:include="include :: footer" />
    <script src="../../../../../../../../../../../../js/breadcrumb.js"></script>
     <script th:inline="javascript">
         var editFlag = [[${@permission.hasPermi('ruoyi:from:edit')}]];
         var removeFlag = [[${@permission.hasPermi('ruoyi:from:remove')}]];
         var creadFlag = [[${@permission.hasPermi('ruoyi:from:add')}]];
         var aStatus = [[${@dict.getType('dept_status')}]];
         var prefix = ctx + "ruoyi/agr";
         var prefixs = ctx + "ruoyi/agr";
         var aprefix =ctx + "ruoyi/from";

         $(function() {
             var options = {
                 url: prefixs + "/list",
                 createUrl: aprefix + "/add/{id}",
                 removeUrl: aprefix + "/remove",
                 exportUrl: prefix + "/export",
                 updateUrl: aprefix + "/edit/{id}",
                 modalName:"项目经理催款列表",
                 showColumns: false,
                 detailView: true,
                 mobileResponsive: false,
                 cardView: true,
                 onExpandRow: function (index, row, $detail) {
                     initChildTable(index, row, $detail);
                 },
                 columns: [
                     {
                         field: 'pId',
                         title: 'ID',
                         visible: false
                     },

                     {
                         field: 'pFileName',
                         title: '文件名称'
                     },
                     {
                         field: 'pTheHeir',
                         title: '上传人'
                     },
                     {
                         field: 'pTime',
                         title: '上传时间'
                     },
                     {
                         title: '操作',
                         align: 'center',
                         formatter: function(value, row, index) {
                             var actions = [];
                             actions.push('<a class="btn btn-success ' + creadFlag + '" href="javascript:void(0)" onclick="$.operate.add(\'' + row.pId + '\')"><i class="fa fa-add"></i>添加</a> ');
                             return actions.join('');
                         }
                     }]
             };
             $.table.init(options);
         });
         initChildTable = function (index, row, $detail) {
             var childTable = $detail.html('<table style="table-layout:fixed"></table>').find('table');
             $(childTable).bootstrapTable({
                     url: aprefix + "/list",
                     method: 'post',
                     sidePagination: "server",
                     contentType: "application/x-www-form-urlencoded",
                     queryParams: {
                         pId:row.pId,
                     },
                     columns: [

                         {
                             field: 'aLabor',
                             title: '劳务合同',
                             width: 100,
                         },
                         {
                             field: 'dCost',
                             title: '劳务金额',
                             width: 100,
                         },
                         {
                             field: 'dSupplierName',
                             title: '供应商/应付单位名称',
                             width: 150,
                         },
                         {
                             field: 'dProposer',
                             title: '申请人',
                             width: 100,
                         },
                         {
                             field: 'dApplicationContent',
                             title: '申请内容',
                             width: 100,
                         },
                         {
                             field: 'dCreateTime',
                             title: '申请时间',
                             width: 100,
                         },
                         {
                             field: 'dFile',
                             title: '照片',
                             width: 100,
                             formatter: function(value, row, index) {
                                 return $.table.imageView(value);
                             }
                         },
                         {
                             field: 'pId',
                             title: '总项目关联',
                             visible: false
                         },
                         {
                             field: 'aStatus',
                             title: '申请状态',
                             width: 100,
                             align: "center",
                             formatter: function(value, row, index) {
                                 return $.table.selectDictLabel(aStatus, value);
                             }
                         },
                         {
                             field: 'aOpinion',
                             title: '审批意见',
                             width: 100,
                         },
                         {
                             title: '操作',
                             width: 100,
                             align: 'center',
                             formatter: function(value, row, index) {
                                 var actions = [];

                                 if (row.aStatus ==0){
                                     actions.push('<a class="btn btn-info btn-xs" href="javascript:void(0)" onclick="submitApply(\'' + row.dId+ '\')"><i class="fa fa-user"></i> 未付款</a> ');
                                     actions.push('<a class="btn btn-warning btn-xs" href="javascript:void(0)" onclick="over(\'' + row.dId+ '\')"><i class="fa fa-user"></i> 已付款</a> ');
                                     actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.dId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                                     actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.dId + '\')"><i class="fa fa-remove"></i>删除</a>');
                                 }

                                 return actions.join('');
                             }
                         }
                     ]
                 }
             );
         };
         function submitApply(dId) {
             $.modal.confirm("确认要提交给项目总监吗?", function() {
                 var url = aprefix + "/submitApply";
                 var data = { "dId": dId};
                 $.operate.submit(url, "post", "json", data);
             });
         }
         function over(dId) {

             $.modal.confirm("付款成功了", function() {
                 var url = aprefix + "/over";
                 var data = { "dId": dId };
                 $.operate.submit(url, "post", "json", data);
             });
         }

     </script>
</body>
</html>